# -*- coding: UTF-8 -*-
# Project : bio_tc
# File : upload.py
# IDE : PyCharm
# Author : 博科（鑫贝西）田聪
# Date : 2021/11/29 14:51
import os

import pandas as pd
from tools.toMysql import MySqlLink
from copy import deepcopy
for k,v,d in os.walk(r'D:\bio_tc\zhaobiao\tools\excel2'):
    for i in d:
        addr = k + os.sep + i
        e = pd.read_excel(addr)
        c = MySqlLink()
        items = []
        for i in e.values:
            if i[-1] == '成功' and i[0] !='-':
                item = {
                    'bid_winner':i[0],
                    'legal_person':i[1],
                    'phone':i[13],
                    'province':i[5],
                    'address':i[15].replace('\'','').replace('{','').replace('}','').replace('"',''),
                }
                item = dict(item)

                items.append(deepcopy(item))
        c.item_update(items)